use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

use super::{FileTimeScope, StationInfo};

/// 波形视图主结构
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct StationAudioView {
    /// 测站列表
    pub station_audios: Vec<StationAudio>,
    /// 降采样后的波形数据
    pub scale_datas: Vec<ScaleData>,
    /// 窗口配置
    pub window_config: WindowConfig,
}

/// 测站音频数据
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct StationAudio {
    /// 显示配置
    pub display_config: DisplayConfig,
    /// 文件时间范围列表
    pub time_scope_list: Vec<FileTimeScope>,
    /// 测站信息
    pub station_info: StationInfo,
}

/// 显示配置
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct DisplayConfig {
    /// 是否显示
    pub display: bool,
    /// 排序
    pub order: i32,
    /// 选中的通道
    pub selected_channel: i32,
    /// 最大值
    pub max_value: f32,
    /// 最小值
    pub min_value: f32,
}

/// 降采样数据
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ScaleData {
    /// 测站ID
    pub boardid: i32,
    /// 降采样后的数据（2000个点）
    pub list: Vec<f32>,
}

/// 窗口配置
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct WindowConfig {
    /// 窗口起始时间
    pub current_window_start_time: f64,
    /// 窗口结束时间
    pub current_window_end_time: f64,
    /// 窗口持续时间
    pub current_window_duration: f64,
}
